package ai.george.quickstart.advisor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClientRequest;
import org.springframework.ai.chat.client.ChatClientResponse;
import org.springframework.ai.chat.client.advisor.api.CallAdvisor;
import org.springframework.ai.chat.client.advisor.api.CallAdvisorChain;


@Slf4j
public class MyAdvisor1 implements CallAdvisor {
    @Override
    public ChatClientResponse adviseCall(ChatClientRequest chatClientRequest, CallAdvisorChain callAdvisorChain) {

        //前置处理
        log.info("MyAdvisor1 begin......");

        //调用下一个Advisor
        ChatClientResponse chatClientResponse = callAdvisorChain.nextCall(chatClientRequest);

        //后置处理
        log.info("MyAdvisor1 end。。。。。。");

        return chatClientResponse;
    }

    @Override
    public String getName() {
        return "MyAdvisor1";
    }

    @Override
    public int getOrder() {
        return 1;
    }
}
